#include <iostream>

using namespace std;

void swap(int &a, int &b)
{
	int i = a;
	a = b;
	b = i;
}
int main()
{
	int arr1[] = { 5, 4, 3, 2, 1 };

	for (int i = 0; i < 5; ++i)
	{
		int Temp = i;
		for (int k = Temp + 1; k < 5; ++k)
		{
			if (arr1[Temp] > arr1[k])
				Temp = k;
		}
		swap(arr1[i], arr1[Temp]);
	}
	for (auto T : arr1)
		cout << T << endl;

	return 0;
}
